<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./css/main.css" />
  </head>
  <body>
    <div class="imgs">
      <div class="main-img">
        <img id="mainImg" src="./imgs/1.jpg" alt="" />
      </div>
      <div class="thumb-img">
        <div><img data-thumb src="./imgs/1.jpg" alt="" /></div>
        <div><img data-thumb src="./imgs/2.jpg" alt="" /></div>
        <div><img data-thumb src="./imgs/3.jpg" alt="" /></div>
        <div><img data-thumb src="./imgs/4.jpg" alt="" /></div>
        <div><img data-thumb src="./imgs/5.jpg" alt="" /></div>
      </div>
    </div>
    <script>
      document.onclick = function (e) {
        const thumb = e.target.dataset.thumb;
        if (thumb !== undefined) {
          mainImg.src = e.target.src;
        }
      };
    </script>
  </body>
</html>
